#ifndef CARDSTACK_H
#define CARDSTACK_H

#include <QWidget>
#include <QVector>
#include "card.h"

class CardStack : public QWidget {
    Q_OBJECT
public:
    explicit CardStack(QWidget* parent = nullptr);
    void addCard(Card* card);
    void removeCard(Card* card);
    QVector<Card*> cards() const;
    void clear();
    void setSpacing(int spacing);
    void flipTopCard();

protected:
    void dragEnterEvent(QDragEnterEvent* event) override;
    void dragMoveEvent(QDragMoveEvent* event) override;
    void dropEvent(QDropEvent* event) override;

private:
    void updateLayout();
    QVector<Card*> m_cards;
    int m_spacing;
};

#endif // CARDSTACK_H
